import * as events from '../events'

const state = {
    userName: '1'
}

const getters = {
    userName(state) {
        return state.userName + 'getter'
    }
}

const actions = {
    setUserName(context, data) {
        setTimeout(() => {
            context.commit(events.SET_USER_NAME, data)
        }, 1000)
    }
}

const mutations = {
    [events.SET_USER_NAME]: function (state, data) {
        state.userName = data
    }
}
export default {
    state,
    getters,
    actions,
    mutations
}
